#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>

enum ENUM_A
{
	X1,
	Y1,
	Z1 = 255,
	A1,
	B1,
};
int main()
{
	enum ENUM_A enumA = Y1;
	enum ENUM_A enumB = B1;
	printf("%d %d\n", enumA, enumB);
	return 0;
}




union Un
{
	short s[7];
	int n;
};
int main()
{
	printf("%d\n", sizeof(union Un));
	return 0;
}


int main()
{
    union
    {
        short k;
        char i[2];
    }*s, a;
    s = &a;
    s->i[0] = 0x39;
    s->i[1] = 0x38;
    printf("%x\n", a.k);
    return 0;
}


char* GetMemory(void)
{
	char p[] = "hello world";
	return p;
}
void Test(void)
{
	char* str = NULL;
	str = GetMemory();
	printf(str);
}



#define MAX 10

int main()
{
    int arr[MAX] = { 1,2,3,4,5,1,2,3,4,6 };
    int i = 0;
    while (i != MAX)
    {
        int j = 0;
        int flag = 0;
        for (j = 0; j < MAX; j++)
        {
            if ((arr[i] == arr[j]) && (i != j))
            {
                flag = 1;
            }
        }
        if (flag == 0)
        {
            printf("%d\n", arr[i]);
        }
        i++;
    }
	return 0;
}


#include<string.h>
#include<assert.h>


char* my_strncat(char* dest,const char* sour, int num)
{
	assert(dest && sour);
	char* ret = dest;
	while (*dest != '\0')
	{
		dest++;
	}
	int i = 0;
	for (i = 0; i < num; i++)
	{
		dest[i] = sour[i];
	}
	return ret;
}

int main()
{
	char arr1[20] = "hello ";
	char arr2[] = "world";
	my_strncat(arr1, arr2, 4);
	printf(arr1);
	return 0;
}


char* my_strncpy(char* dest,const char* sour, int num)
{
	assert(dest && sour);
	int i = 0;
	for (i = 0; i < num; i++)
	{
		dest[i] = sour[i];
	}
	return dest;
}

int main()
{
	char arr1[20] = { 0 };
	char arr2[] = "hello world";
	my_strncpy(arr1, arr2, 11);
	printf("%s\n",arr1);
	return 0;
}